<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<meta name="renderer" content="webkit">
  		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title>个人中心-个人信息（修改资料）</title>
		<link rel="stylesheet" type="text/css" href="/boot/cssl/layui/css/layui.css"/>
		<link rel="stylesheet" type="text/css" href="/boot/cssl/css/admin.css"/>
	</head>
	<body>
		<div class="layui-tab page-content-wrap">
		  <ul class="layui-tab-title">
				<p style="font-size: 20px;margin-bottom: 20px">信息修改</p>
		  </ul>
		  <div class="layui-tab-content">
		    <div class="layui-tab-item layui-show">
		    	<form class="layui-form"  style="width: 90%;padding-top: 20px;" id="user_update" >
<%--				  <div class="layui-form-item" >--%>
<%--				    <label class="layui-form-label">用户名：</label>--%>
<%--				    <div class="layui-input-block">--%>
<%--				      <input type="text" name="username" disabled autocomplete="off" class="layui-input layui-disabled" value="${uname}">--%>
<%--				    </div>--%>
<%--				  </div>--%>
				   <div class="layui-form-item">
				    <label class="layui-form-label">修改用户名：</label>
				    <div class="layui-input-block">
				      <input type="text" name="uname" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input" id="uname"  value="">
				    </div>
				  </div>
				  <div class="layui-form-item">
				    <label class="layui-form-label">修改密码：</label>
				    <div class="layui-input-block">
				      <input type="text" name="pwd" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input" id ="pwd" value="">
				    </div>
				  </div>
				  <div class="layui-form-item">
				    <div class="layui-input-block">
				      <button class="layui-btn layui-btn-normal" lay-submit lay-filter="adminInfo"  id="updatex">立即提交</button>
				    </div>
				  </div>
				</form>
		    </div>
		  </div>
		</div>
	<script src="/boot/cssl/layui/layui.js" type="text/javascript" charset="utf-8"></script>
		<script src="/boot/plugins1/jquery/jquery.min.js"></script>
	<script>

			$(function(){
				$("#updatex").click(function(){
					// alert("点击成功");
					// let value = $("#user_update").serialize();
					let uname = $("#uname").val();
					let pwd = $("#pwd").val();
					$.post('/boot/update', {"uname":uname,"pwd":pwd},function(data) {
                        console.log("点击成功");
                         console.log(data.code);
						if(data.code=="200")
						{
							alert("修改成功");
						}
						if(data.code=="400")
						{
							alert("格式错误");
						}

						if(data.code=="201")
						{
							alert("用户名已被占用");
						}
					}
					)
				})})

		//Demo
		layui.use(['form','element'], function(){
		  var form = layui.form();
		  var element = layui.element();
		  form.render();
		  //监听信息提交
		  form.on('submit(adminInfo)', function(data){
		    layer.msg(JSON.stringify(data.field));
		    return false;
		  });
		  //监听密码提交
		   form.on('submit(adminPassword)', function(data){
		    layer.msg(JSON.stringify(data.field));
		    return false;
		  });
		});
	</script>
	</body>
</html>